package com.dynamic.springbootdynamic.controller;

import com.dynamic.springbootdynamic.entity.User;
import com.dynamic.springbootdynamic.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource(name="userServiceImpl")
    private UserService userService;

    @RequestMapping("/getAllUser")
    public String getAllUser(){
        System.out.println("userService:"+userService);
        List<User> list =  userService.list(null);
        System.out.println(list);
        return "getAllUser";
    }

    @RequestMapping("/insert")
    public String inserUser(){
        User user = new User(6,"林明谦",27,"337378893@qq.com");
        userService.save(user);
        return "sucess";
    }
}
